#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long LL;
const int MAXN = 100007;
struct Point{
    LL a, b;
} point[MAXN];
struct List{
    LL a;
    LL id;
}list[MAXN];
LL C[MAXN];
bool cmpP(Point p1, Point p2) {
    return p1.a-p1.b > p2.a-p2.b;
}
bool cmpL(List l1, List l2) {
    return l1.a > l2.a;
}

int main() {
#ifdef hai
    //freopen("in.txt", "r", stdin);
#endif
    LL n, l;
    while (cin>>n>>l) {
        LL cnt=0, bb=0;
        for (int i=1; i<=n; ++i) {
            scanf("%lld %lld", &point[i].a, &point[i].b);
        }
        LL cc=0;
        for (int i=1; i<=n; ++i) {
            scanf("%lld", &C[i]);
            cc += C[i];
            C[i] = cc;
        }
        sort(point+1, point+n+1, cmpP);
        for (int i=1; i<=n; ++i) {
            list[i].a = point[i].a;
            list[i].id = i;
        }
        sort(list+1, list+n+1, cmpL);
        int res = -1;
//        printf("----------------\n");
//        for (int i=0; i<n; ++i) {
//            printf("%lld %lld\n", point[i].a, point[i].b);
//        }
//        printf("----------------\n");
//        for (int i=0; i<n; ++i) {
//            printf("%lld %lld\n", list[i].a, list[i].id);
//        }
//        printf("----------------\n");
        for (int i=1; i<n; ++i) {
            LL r = 0;
            LL ll = l - list[i].a;
            int id = list[i].id;
            int flag = 0;
            int j;
//            printf("list[%d].a: %lld\n", i, list[i].a);
            for (j=0; j<n; ++j) {
                cc = C[j];
                if (j >= id) {
                    r += (point[j+1].a - point[j+1].b);
                }
                else {
                    r += (point[j].a - point[j].b);
                }
//                printf("i: r vs cc: %d: %lld %lld\n", i, r, cc);
                if (cc >= r && cc != 0) {
                    flag = -1;
                    break;
                }
                if (r >= ll) {
                    flag = 1;
                    break;
                }
            }
            if (flag==1 && r+list[i].a > C[j]) {
                res = j+1;
                break;
            }
            if (cc>=r && cc>0 && id>j) {
                break;
            }
        }
        cout<<res<<endl;
    }
    return 0;
}
